const fs = require("fs");
const { beijingTime } = require("../tools/timer");

exports.deleFile = (filePath, res) => {
	fs.unlink(filePath, (err) => {
		if (err) {
			return res.status(403).send({
				state: "fail!",
				message: "文件不存在",
				timestamp: beijingTime,
			});
		}
		return res.status(200).send({
			state: "success",
			message: "删除成功",
			timestamp: beijingTime,
		});
	});
};
